from selenium.webdriver.common.by import By


class  NewTicketLocator:
    #Ticket菜单
    ticket_tab = (By.XPATH, "//div[contains(@data-menu-id,'TICKET')]")
    # new ticket菜单
    new_ticket_tab = (By.CSS_SELECTOR, '[path="/work_bench/tickets/newTicket"]')
    my_ticket_tab = (By.CSS_SELECTOR, '[path="/work_bench/tickets/myTicket"]')

    # add_Consulting_ticket
    #Financial Support
    #add_financial_support_ticket = (By.XPATH, "/html/body/div[1]/section/section/main/div/main/div/div/div/div[2]/div/div/div[1]/div[2]/div/div[1]/div/div[2]/a")
    add_financial_support_ticket = (By.XPATH, '//*[text()="Financial Support"]/../a')

    # add_Consulting_ticket
    # Financial Support
    add_compute_ticket = (By.XPATH, '//*[text()="Compute"]/../a')

    # ticket_Current_Issue
    #ticket_show_current_issun_list = (By.XPATH,"/html/body/div[1]/section/section/main/div/main/div/div/div[1]/div[3]/div/div/div/form/div[2]/div[2]/div/div")
    ticket_show_current_issun_list = (By.XPATH,'//*[@id="issueId"]/..')
    ticket_current_issue_list = (By.CSS_SELECTOR,'[title="Tax"]')

    #ticket_description
    ticket_description=(By.XPATH, '//*[@id="description"]')

    #Additional Confidential Information
    ticket_additional = (By.XPATH, '//*[@id="additionalContent"]')

    # Submit
    ticket_submit = (By.XPATH, "/html/body/div[1]/section/section/main/div/main/div/div/div[2]/div[1]/button[1]")

    #最近一条创建的工单
    last_ticket = (By.XPATH,"/html/body/div[1]/section/section/main/div/main/div/div/div/div[2]/div/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[2]/div")

    #Compute sub product列表
    #sub_product = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div[1]/div[3]/div/div/div/form/div[2]/div[2]/div/div/div/div')
    sub_product = (By.XPATH,'//*[@id="subProduct"]/..')

    #ticket_sub_pro_com = (By.CSS_SELECTOR, '[title="Container Registry"]')
    ticket_sub_pro_com = (By.XPATH, '/html/body/div[3]/div/div/div/div[2]/div/div/div/div')

    # ticket_Current_Issue_Com
    # ticket_show_current_issun_list_com = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div[1]/div[3]/div/div/div/form/div[3]/div[2]/div/div/div/div')
    ticket_show_current_issun_list_com = (By.XPATH,'//*[@id="issueId"]/..')

    #ticket_show_current_issun_list_com = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div[1]/div[3]/div/div/div/form/div[3]/div[2]/div/div/div/div')
    ticket_current_issue_list_com = (By.CSS_SELECTOR, '[title="Console Operations"]')

    #priority_level
    priority_level = (By.XPATH,'//*[@id="priorityLevel"]/..')
    priority_level_low = (By.CSS_SELECTOR, '[title="Low"]')

    #最近一条工单的id
    last_ticket_id = (By.XPATH,"(//a[contains(@class,'cre-table-nowrap')])[1]")

    #ticket目录的名称
    technical_first_category = (By.XPATH,'(//h2[contains(@class,"title___1Fqrl"])[4]')
    technical_second_category = (By.XPATH, '(//h2[contains(@class,"title___1Fqrl"])[5]')
    technical_third_category = (By.XPATH, '(//h2[contains(@class,"title___1Fqrl"])[6]')
    technical_fourth_category = (By.XPATH, '(//h2[contains(@class,"title___1Fqrl"])[7]')
    technical_fifth_category = (By.XPATH, '(//h2[contains(@class,"title___1Fqrl"])[8]')
    technical_sixth_category = (By.XPATH, '(//h2[contains(@class,"title___1Fqrl"])[9]')
    def get_category_name(self,number):
        technical_category = (By.XPATH,'(//h2[contains(@class,"1Fqrl")])['+str(number)+']')
        return technical_category

    #创建按钮
    def get_create_button(self,number):
        tech_ask_button = (By.XPATH, '(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])['+str(number)+']')
        return tech_ask_button

    tech_ask_button_1 = (By.XPATH,'(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])[4]')
    tech_ask_button_2 = (By.XPATH, '(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])[5]')
    tech_ask_button_3 = (By.XPATH, '(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])[6]')
    tech_ask_button_4 = (By.XPATH, '(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])[7]')
    tech_ask_button_5 = (By.XPATH, '(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])[8]')
    tech_ask_button_6 = (By.XPATH, '(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])[9]')
    tech_ask_button_7 = (By.XPATH, '(//a[contains(@href,"/work_bench/tickets/newTicket/createTicket")])[10]')

    #详情页
    product_name = (By.ID,'productName')

    #获取sub product的位置
    def get_sub_product_locate(self,subProductName):
        locate = "[title='" + subProductName + "']"
        sub_product = (By.CSS_SELECTOR,locate)
        return sub_product

    #返回按钮
    #back_button = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div[1]/div[2]/div/div/span[1]')
    back_button = (By.XPATH,'//*[@class="cre-page-container-header-panel-left"]/span[@role="img"]')


    redis = (By.XPATH,'/html/body/div[3]/div/div/div/div[2]/div/div/div/div[3]')

    # 工单列表页状态筛选按钮
    ticket_status_filter = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div/div[2]/div/div/div/div/div/table/thead/tr/th[8]/div/span[2]')
